package com.itheima.service.impl.rabbitmq.direct;

import com.itheima.service.MessageService;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * ClassName: MessageServiceRabbitmqDirectImpl
 * Description:
 * Date: 2023/03/19 AM 10:49:16
 * <p>
 * project: springboot
 * package: com.itheima.service.impl.rabbitmq.direct
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
// @Service
public class MessageServiceRabbitmqDirectImpl implements MessageService {

    @Autowired
    private AmqpTemplate amqpTemplate;

    /**
     * 发送消息
     *
     * @param id {@link String} 订单 id
     */
    @Override
    public void sendMessage(String id) {
        System.out.println("待发送短信的订单已纳入处理队列(rabbitmq direct), id: " + id);
        amqpTemplate.convertAndSend("directExchange", "direct", id);
    }

    /**
     * 发送消息
     *
     * @return {@link String}
     */
    @Override
    public String doMessage() {
        return null;
    }
}
